Type error: Type does not satisfy the constraint 'PageProps'.
Category: it
nextjs
Views: 0Type error: Type '{ params: { userId: string } }' does not satisfy the constraint 'PageProps'.
// Before
const User = async (
{params: { userId }} : {params: { userId: string };
}) => {
const [currentUserData] = await getCurrentUserData(userId);
};
// After
type Params = Promise<{ userId: string }>;
const User = async ({ params }: { params: Params }) => {
const [currentUserData] = await getCurrentUserData(
(await params).userId
);
};
https://nextjs.org/docs/app/guides/upgrading/version-15#async-request-apis-breaking-change
Comments (0)
Loading comments...